using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Collections.Generic;
using T.FAS.Runtime.UserProfile.Dao;
using T.FAS.Runtime.UserProfile.Entity;
using T.FAS.Runtime.UserProfile.Service;
using System;
using Newtonsoft.Json;

namespace T.FAS.Runtime.UserProfile.UnitTest
{
    [TestClass]
    public class UnitTest1
    {
        UserProfilesService userProfilesService = new UserProfilesService();
        UserProfiles userProfiles = new UserProfiles
        {
            ItemID = "9999",
            ProfileValue = "ProfileValue",
            ProfileText = "ProfileText"
        };
        [TestMethod]
        public void CreateOrUpdateUserProfile()
        {
            var dic = userProfilesService.CreateOrUpdateUserProfile(userProfiles);
            Assert.IsTrue(dic["state"].ToString() == "1");
            userProfiles = userProfilesService.GetUserProfile(userProfiles.ItemID);
            Assert.IsNotNull(userProfiles);
            dic = userProfilesService.CreateOrUpdateUserProfile(userProfiles);
            Assert.IsTrue(dic["state"].ToString() == "1");
            dic = userProfilesService.DeleteUserProfile(userProfiles.ItemID);
            Assert.IsTrue(dic["state"].ToString() == "1");
            userProfiles = userProfilesService.GetUserProfile(userProfiles.ItemID);
            Assert.IsNull(userProfiles);
        }
        [TestMethod]
        public void GetUserProfiles()
        {
            var userProfileList = userProfilesService.GetUserProfiles("2b4c9228-8d9a-4805-83d4-9ca7b35407ab");
            Assert.IsTrue(userProfileList.Count > 0) ;
        }
        [TestMethod]
        public void GetUserProfile()
        {
            UserProfilesService userProfilesService = new UserProfilesService();
            var userProfile = userProfilesService.GetUserProfile("9090683a-8c12-4810-a5bb-41b719aa9103");
            Assert.IsNotNull(userProfile);
        }
    }
}
